<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>修改用户密码</title>
	<link href="<%=path %>/css/index_css.css" rel="stylesheet" type="text/css" />
	<script language="javascript" src="<%=path %>/js/syAjax.js"></script>
	<script type="text/javascript">
		function doUser()
		{
		  var password=document.getElementById("password");
		  var password1=document.getElementById("password1");
		  var password2=document.getElementById("password2");
		  if(password.value=="")
		  {
		    alert("密码不能为空！");
		    password.focus();
		    return;
		  }
		  if(password1.value!=password2.value)
		  {
		  	alert("两次输入的新密码必须一致！");
		  	password1.value="";
		  	password2.value="";
		  	password1.focus();
		  	return;
		  }
		  if(password1.value=="")
		  {
		  	alert("输入的新密码不允许为空！");
		  	return;
		  }
		  syAjax.request("post","<%=path %>/updateUserPasswordUserAction.action","user.userId=${sessionScope.UserInfo.userId}&user.password="+password.value+"&password1="+password1.value,{success:initSuccessResult,fail:onFail,type:'plain'});
		 	
		}
		
		function initSuccessResult(data){
		if(data=="true")
		{
		    alert("修改密码成功！");
		    window.returnValue=data;
			window.close();
		}
		else
		{
			alert("修改密码失败，请确认您输入的信息是否有误！");
		}
			
		}
		
		//2011-7-18 闷男 按回车键跳到下一元素
		function document.onkeydown(){
		if(event.keyCode==13)
			if(document.activeElement && document.activeElement.type=='button') {
				doUser();
			}else {
				event.keyCode=9;
			}
		}
		
	</script>
  </head>
  
  <body bgcolor="#ECE9D8">
   <form action="" name="classForm" method="post">
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="41%" bgcolor="#ECE9D8">&nbsp;</td>
    <td width="59%" align="left" bgcolor="#ECE9D8">&nbsp;</td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#ECE9D8" class="f_6">用户名：</td>
    <td align="left" bgcolor="#ECE9D8" class="f_6"><input type="text" style="width:150px" id="name" value="${sessionScope.UserInfo.account}" readonly="readonly"/></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#ECE9D8"><span class="f_6">原密码：</span></td>
    <td align="left" bgcolor="#ECE9D8" class="f_6"><input style="width:150px" type="password" id="password" value="" /></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#ECE9D8"><span class="f_6">新密码：</span></td>
    <td align="left" bgcolor="#ECE9D8" class="f_6"><input style="width:150px" type="password" id="password1" /></td>
  </tr>
  <tr>
    <td height="30" align="right" bgcolor="#ECE9D8"><span class="f_6">确认新密码：</span></td>
    <td align="left" bgcolor="#ECE9D8" class="f_6"><input style="width:150px" type="password" id="password2" /></td>
  </tr>
  <tr>
    <td colspan="2" align="center" bgcolor="#ECE9D8">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#ECE9D8">&nbsp;</td>
    <td height="40" align="left" bgcolor="#ECE9D8"><label>
      <input type="button" onclick="doUser();" name="Submit" value="提 交" />
    </label></td>
  </tr>
 </table>
 </form>
  </body>
</html>
